import React, { Component, PureComponent } from "react";

class Child extends PureComponent {
  render() {
    console.log("child render");
    return <div>child子组件</div>;
  }
}

// const obj = { a: 3 };
class App extends Component {
  state = {
    count: 1,
    obj: { a: 3 },
  };

  fn = () => {
    console.log(123);
  };
  render() {
    return (
      <>
        <h2>useCallback</h2>
        <p>count: {this.state.count}</p>
        <button onClick={() => this.setState({ count: this.state.count + 1 })}>
          btn
        </button>
        <Child name="zhangsan" obj={this.state.obj} onAbc={this.fn} />
      </>
    );
  }
}

export default App;
